home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 25 / AACD 25.iso / AACD / Graphics / PerfectPaint / rexx / general / GIMPGradient.rx next >
Encoding:
Text File  |  2001-08-30  |  1.2 KB  |  73 lines

  1. /*
  2.     Draw and Anim Lens Flare
  3. */
  4.  
  5.  
  6.     options results
  7.     parse ARG Port b
  8.  
  9.     ADDRESS value Port    
  10.     pp_ClearRange 0
  11.     
  12.     file="RAM:"
  13.     option=0
  14.  
  15.     pp_DialogInit 250 90 "*Load*ASCII*GIMP*GRADIENT" 3
  16.         pp_String 0 50 12 150 16 "Name" 1 100 file
  17.         pp_Getfile 1 205 13 0 "Load*Gradient" 0 file
  18.         pp_Cycle 2 100 32 100 16 "Range" 1 "1|2|3" option
  19.     pp_Dialog    
  20.  
  21.     rc=result
  22.     if rc=0 then
  23.         do
  24.             EXIT
  25.         end    
  26.  
  27.     pp_GetDialog 0
  28.     file=result
  29.  
  30.     pp_GetDialog 2
  31.     option=result
  32.  
  33.     ADDRESS COMMAND
  34.     IF OPEN('b',file,'R') then DO
  35.         Title=READLN('b')
  36.         Nb=READLN('b')
  37.  
  38.         DO j=0 to Nb-1
  39.             T=READLN('b')
  40.             P.0=trunc(substr(T,1,8)*19+0.5,0)
  41.             P.1=trunc(substr(T,10,8)*19+0.5,0)
  42.             P.2=trunc(substr(T,19,8)*19+0.5,0)
  43.             
  44.             R.0=substr(T,28,8)*255
  45.             G.0=substr(T,37,8)*255
  46.             B.0=substr(T,46,8)*255
  47.             A.0=substr(T,55,8)*255
  48.  
  49.             R.2=substr(T,64,8)*255
  50.             G.2=substr(T,73,8)*255
  51.             B.2=substr(T,82,8)*255
  52.             A.2=substr(T,91,8)*255
  53.         
  54.             R.1=R.0+(R.2-R.0)/2
  55.             G.1=G.0+(G.2-G.0)/2
  56.             B.1=B.0+(B.2-B.0)/2
  57.             A.1=A.0+(A.2-A.0)/2
  58.  
  59.  
  60.             ADDRESS value Port
  61.             
  62.             DO i=0 to 2
  63.                 R.i=trunc(R.i+0.5,0)
  64.                 G.i=trunc(G.i+0.5,0)
  65.                 B.i=trunc(B.i+0.5,0)
  66.                 A.i=255-trunc(A.i+0.5,0)
  67.                 pp_setRange option P.i R.i G.i B.i A.i
  68.             END            
  69.         END
  70.  
  71. EXIT
  72.  
  73.